package ShipIt::Step::CheckYAMLChangeLog;

use strict;
use warnings;
use Module::Changes;


our $VERSION = '0.03';


use base 'ShipIt::Step::CheckChangeLog';


sub check_file_for_version {
    my ($self, $file, $version) = @_;
    my $parser = Module::Changes->make_object_for_type('parser_yaml');
    my $changes = $parser->parse_from_file($file);
    for my $release ($changes->releases) {
        my $rel_version = $release->version_as_string;
        return 1 if $rel_version =~ /^v?\Q$version\E$/;
    }
    warn "No mention of version '$version' in changelog file '$file'\n";
    return 0;
}


1;


__END__

{% USE p = PodGenerated %}

=head1 NAME

ShipIt::Step::CheckYAMLChangeLog - ShipIt step for YAML Changes files

=head1 SYNOPSIS

None.

=head1 DESCRIPTION

This is like the CheckChangeLog step from ShipIt, but it can handle YAML
Changes files as defined in L<Module::Changes>.

To use it, just list in your C<.shipit> file.

{% PROCESS standard_pod %}

=cut

